<div class="article">
  <h3 title="<%= article.id %>"><%= link_to_unless_current article.title, discipline_article_path(article.discipline, article) %></h3>

  <span class="byline"><strong><%= date article.created_at %></strong> by <%= link_to article.user.name, profile_url(article.user.login) %></span>
    <% unless listing %>
      <% if article.user == current_user %>
        <span class="edit"><%= link_to 'update  article',edit_discipline_article_path(article.discipline, article) %></span>
        &nbsp;
      <% end %>
      <% can_edit?(article) do %>
        <span class="delete"><%= link_to 'delete',discipline_article_path(article.discipline, article), :method => :delete, :confirm => 'Are you sure you want to delete this?' %></span>
      <% end %>
    <% end %>

  <% if listing %>
    <br />
    <br />
    <%= simple_format(truncate(white_list(article.body), 300, '...')) %>
  <% else %>
    <%= white_list(simple_format(article.body)) %>
  <% unless article.document.blank? %>
    <div class="column span-16 article-downloads"> 
      <div class="column span-7"><h4>Download Article</h4></div>
      <div class="column span-5 last document">
        <%= link_to "view all #{article.document_versions.count} versions", '#', {:class => 'show-version-links', :id => "show-documents-#{article.id}"} if article.document_versions.count > 1 %>
        <%= link_to "hide old versions", '#', {:class => 'hide-version-links', :id => "hide-documents-#{article.id}"} if article.document_versions.count > 1 %>
      </div>
    </div>
    <%= show_document(article.document) %>       
    <div class="other-article-versions" id="article-version-<%= article.id %>">
      <% article.document_versions.each do |document| %>
        <% if document != article.document %>
          <%= show_document(document) %><br />
        <% end %>
      <% end %>
    </div>
    <% end %>
  <% end %>
  <% if listing %>  
    <p><%= show_document(article.document) unless article.document.blank? %></p>
    <%= link_to_unless_current "#{article.comments.count} comment(s) and #{article.reviews.count} review(s)", discipline_article_path(article.discipline, article) %>
  <% end %>
</div>
